package com.cwz.mq.ack.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.cwz.mq.ack.entity.MsgLog;

import java.util.List;

/**
 * <p>
 * 消息投递日志 服务类
 * </p>
 *
 * @author Wen
 * @since 2023-06-14
 */
public interface MsgLogService extends IService<MsgLog> {
	/**
	 * @Description: 插入一条消息投递日志记录
	 * @Author: Wen
	 * @param msgLog:
	 * @return: void
	 **/
	void insertMsg(MsgLog msgLog);

	/**
	 * @Description: 修改消息投递日志记录的状态
	 * @Author: Wen
	 * @param msgId:	消息唯一标识
	 * @param status:  	状态: 0投递中 1投递成功 2投递失败 3已消费
	 * @return: void
	 **/
	void updateMsgStatus(String msgId, Integer status);

	/**
	 * @Description: 消息投递日志记录的重试次数 + 1
	 * @Author: Wen
	 * @param msgId:   	消息唯一标识
	 * @param tryCount: 重试次数
	 * @return: void
	 **/
	void addMsgTryCount(String msgId, Integer tryCount);

	/**
	 * @Description: 查询投递失败的记录
	 * @Author: Wen
	 * @return: java.util.List<com.cwz.mq.ack.entity.MsgLog>
	 **/
	List<MsgLog> selectDeliverFail();

	/**
	 * @Description: 根据消息唯一标识查询记录
	 * @Author: Wen
	 * @param msgId:   消息唯一标识
	 * @return: com.cwz.mq.ack.entity.MsgLog
	 **/
	MsgLog selectByMsgId(String msgId);
}
